import { z } from 'zod'

import { baseManyObjectsScheme, baseSchemeWithNote } from '@/types/base.types'

export const deliveryStatuses: { [index: number]: string } = {
	0: 'Не согласована',
	1: 'Согласована',
	9: 'Доставлено'
}

export const deliveryScheme = baseSchemeWithNote.extend({
	address: z.string(),
	date: z.coerce.date(),
	status: z.number().min(0).max(9),
	paid: z.boolean(),
	claim: z.string(),
	order: z.number().nullable(),
	worker: z.number(),
	attachs: z.number()
})

export type IDelivery = z.infer<typeof deliveryScheme>

export const deliveriesScheme = baseManyObjectsScheme.extend({
	results: z.array(deliveryScheme)
})

export type IDeliveries = z.infer<typeof deliveriesScheme>
